#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include  <chrono>
using geometry_msgs::msg::Twist;
using namespace std::chrono_literals;
class TurtleCircle:public rclcpp::Node
{
public:
    explicit TurtleCircle(const std::string& node_name) :Node(node_name)  
    {
        publisher_=this->create_publisher<Twist>("/turtle1/cmd_vel",10);
        timer_=this->create_wall_timer(1s,bind(&TurtleCircle::timer_callback,this));
    }
private:
    void timer_callback()
    {
        auto msg=Twist();
        msg.linear.x=1.0;
        msg.angular.z=0.5;
        publisher_->publish(msg);
    }
    rclcpp::TimerBase::SharedPtr timer_;
    rclcpp::Publisher<Twist>::SharedPtr publisher_;      
};
int main(int argc,char*argv[])
{
    rclcpp::init(argc,argv);
    rclcpp::spin(std::make_shared<TurtleCircle>("turtle_circle_node_cpp"));
    rclcpp::shutdown();
}